/*
 * dnsRegister.cpp
 *
 *  Created on: Dec 11, 2013
 *      Author: m
 */

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include "../AgentAddressService.h"

int main ( int argc, char* argv[] )
{
    int address;

    if ( argc != 3 )
    {
        std::cerr << "Cantidad de argumentos invalidos." << std::endl;
        std::cerr << "Uso: ." << argv[0] << " [nombre] [direccion]" << std::endl;
        exit( 1 );
    }

    //Save values of command line arguments
    std::string name( argv[1] );
    sscanf( argv[2], "%d", &address );

    address = channel::AgentAddressService::registerNameStatic( name, address );

    std::cout << "The name " << name << " was successfully registered with address " << address << std::endl;

    return 0;
}
